package ooday04.practice;

//测试类
public class Test {
    public static void main(String[] args) {
        Animal[] animal = new Animal[4];
        Master master = new Master();
        animal[0] = new Chick("鸡仔", 1, "鸭子", "橘黄色");
        animal[1] = new Dog("狗腿子", 1, "狗", "黄色");
        animal[2] = new Duck("唐老鸭", 1, "鸭子", "白色");
        animal[3] = new Fish("小鲤鱼", 1, "鱼", "红色");
        for (int i = 0; i < animal.length; i++) {
            System.out.println(animal[i].name);
            animal[i].drink();
            master.feed("zs", animal[i]);
            master.feed("李四", animal[i]);
            if (animal[i] instanceof Swim) {
                Swim swim = (Swim) animal[i];
                swim.swim();
            }
            if (animal[i] instanceof LayEggs) {
                LayEggs layEggs = (LayEggs) animal[i];
                layEggs.layEggs();
            }



        }

    }
}
